#include <stdio.h>

void hieth_set_regbit(long va, int vb, int vc)
{
  /*4005fc:	a9bd7bfd 	stp	x29, x30, [sp, #-48]!
  400600:	910003fd 	mov	x29, sp
  400604:	f9000fa0 	str	x0, [x29, #24]	// va
  400608:	b90017a1 	str	w1, [x29, #20]	// vb
  40060c:	b90013a2 	str	w2, [x29, #16]	// vc
  400610:	b2407fe0 	mov	x0, #0xffffffff            	// #4294967295 
  400614:	f90017a0 	str	x0, [x29, #40]*/
	  unsigned long a = 0xffffffff;

  /*400618:	b94017a0 	ldr	w0, [x29, #20]	// w0 = vb
  40061c:	7100001f 	cmp	w0, #0x0		// vb ?= 0
  400620:	1a9f07e0 	cset	w0, ne  // ne = any
  400624:	12001c00 	and	w0, w0, #0xff
  400628:	b90017a0 	str	w0, [x29, #20] */
	  vb = (vb != 0)&0xff;

  /*40062c:	b94017a0 	ldr	w0, [x29, #20]
  400630:	7100001f 	cmp	w0, #0x0
  400634:	54000080 	b.eq	400644 <hieth_set_regbit+0x48>  // b.none
  400638:	90000000 	adrp	x0, 400000 <_init-0x480>
  40063c:	9124e000 	add	x0, x0, #0x938
  400640:	14000003 	b	40064c <hieth_set_regbit+0x50>
  400644:	90000000 	adrp	x0, 400000 <_init-0x480>
  400648:	91250000 	add	x0, x0, #0x940
  40064c:	90000001 	adrp	x1, 400000 <_init-0x480>
  400650:	91252022 	add	x2, x1, #0x948
  400654:	aa0003e1 	mov	x1, x0
  400658:	aa0203e0 	mov	x0, x2
  40065c:	97ffffa5 	bl	4004f0 <printf@plt>*/
		printf("bit = %s\n", vb ? "Ture" : "Flase");

  /*400660:	b94013a0 	ldr	w0, [x29, #16]	// vc
  400664:	52800021 	mov	w1, #0x1                   	// #1
  400668:	1ac02020 	lsl	w0, w1, w0		// w0 = 1<<vc
  40066c:	2a2003e0 	mvn	w0, w0			// w0 = ~(1<<vc)
  400670:	93407c00 	sxtw	x0, w0
  400674:	f94017a1 	ldr	x1, [x29, #40]	
  400678:	8a000020 	and	x0, x1, x0		
  40067c:	f90017a0 	str	x0, [x29, #40]	// a = a & ~(1<<vc) */
		a = a & ~(1<<vc);
  /*400680:	90000000 	adrp	x0, 400000 <_init-0x480>
  400684:	91256000 	add	x0, x0, #0x958
  400688:	f94017a1 	ldr	x1, [x29, #40]
  40068c:	97ffff99 	bl	4004f0 <printf@plt>*/
		printf("%lx\n", a);

  /*400690:	b94013a0 	ldr	w0, [x29, #16]
  400694:	b94017a1 	ldr	w1, [x29, #20]
  400698:	1ac02020 	lsl	w0, w1, w0
  40069c:	93407c00 	sxtw	x0, w0
  4006a0:	f94017a1 	ldr	x1, [x29, #40]
  4006a4:	aa000020 	orr	x0, x1, x0
  4006a8:	f90017a0 	str	x0, [x29, #40]*/
		a = a | (vb<<vc);

  /*4006ac:	90000000 	adrp	x0, 400000 <_init-0x480>
  4006b0:	9125a000 	add	x0, x0, #0x968
  4006b4:	f94017a1 	ldr	x1, [x29, #40]
  4006b8:	97ffff8e 	bl	4004f0 <printf@plt>*/
		printf("%lx\n", a);

  /*4006bc:	f90017bf 	str	xzr, [x29, #40] */
		a = 0x0;

  /*4006c0:	b94017a0 	ldr	w0, [x29, #20] 
  4006c4:	7100001f 	cmp	w0, #0x0
  4006c8:	1a9f07e0 	cset	w0, ne  // ne = any
  4006cc:	12001c00 	and	w0, w0, #0xff
  4006d0:	b90017a0 	str	w0, [x29, #20] */
		vb = (vb != 0)&0xff;

  /*4006d4:	b94017a0 	ldr	w0, [x29, #20]
  4006d8:	7100001f 	cmp	w0, #0x0
  4006dc:	54000080 	b.eq	4006ec <hieth_set_regbit+0xf0>  // b.none
  4006e0:	90000000 	adrp	x0, 400000 <_init-0x480>
  4006e4:	9124e000 	add	x0, x0, #0x938
  4006e8:	14000003 	b	4006f4 <hieth_set_regbit+0xf8>
  4006ec:	90000000 	adrp	x0, 400000 <_init-0x480>
  4006f0:	91250000 	add	x0, x0, #0x940
  4006f4:	90000001 	adrp	x1, 400000 <_init-0x480>
  4006f8:	91252022 	add	x2, x1, #0x948
  4006fc:	aa0003e1 	mov	x1, x0
  400700:	aa0203e0 	mov	x0, x2
  400704:	97ffff7b 	bl	4004f0 <printf@plt>*/
		printf("bit = %s\n", vb ? "Ture" : "Flase");

  /*400708:	b94013a0 	ldr	w0, [x29, #16]
  40070c:	52800021 	mov	w1, #0x1                   	// #1
  400710:	1ac02020 	lsl	w0, w1, w0
  400714:	2a2003e0 	mvn	w0, w0
  400718:	93407c00 	sxtw	x0, w0
  40071c:	f94017a1 	ldr	x1, [x29, #40]
  400720:	8a000020 	and	x0, x1, x0
  400724:	f90017a0 	str	x0, [x29, #40] */
		a = a & ~(1<<vc);

  /*400728:	90000000 	adrp	x0, 400000 <_init-0x480>
  40072c:	91256000 	add	x0, x0, #0x958
  400730:	f94017a1 	ldr	x1, [x29, #40]
  400734:	97ffff6f 	bl	4004f0 <printf@plt> */
		printf("%lx\n", a);

  /*400738:	b94013a0 	ldr	w0, [x29, #16]
  40073c:	b94017a1 	ldr	w1, [x29, #20]
  400740:	1ac02020 	lsl	w0, w1, w0
  400744:	93407c00 	sxtw	x0, w0
  400748:	f94017a1 	ldr	x1, [x29, #40]
  40074c:	aa000020 	orr	x0, x1, x0
  400750:	f90017a0 	str	x0, [x29, #40]*/
		a = a | (vb<<vc);

  /*400754:	90000000 	adrp	x0, 400000 <_init-0x480>
  400758:	9125a000 	add	x0, x0, #0x968
  40075c:	f94017a1 	ldr	x1, [x29, #40]
  400760:	97ffff64 	bl	4004f0 <printf@plt>*/
		printf("%lx\n", a);

  /*400764:	d503201f 	nop
  400768:	a8c37bfd 	ldp	x29, x30, [sp], #48
  40076c:	d65f03c0 	ret*/
}

void perfect()
{
  /*400770:	a9bf7bfd 	stp	x29, x30, [sp, #-16]!
  400774:	910003fd 	mov	x29, sp
  400778:	90000000 	adrp	x0, 400000 <_init-0x480>
  40077c:	9125e000 	add	x0, x0, #0x978
  400780:	d2800082 	mov	x2, #0x4                   	// #4
  400784:	528000a1 	mov	w1, #0x5                   	// #5
  400788:	97ffff5a 	bl	4004f0 <printf@plt>*/
	printf("%d %d\n", 0x5, 0x4);

  /*40078c:	d503201f 	nop
  400790:	a8c17bfd 	ldp	x29, x30, [sp], #16
  400794:	d65f03c0 	ret*/
}

void perfect2()
{
  /*400798:	a9bf7bfd 	stp	x29, x30, [sp, #-16]!
  40079c:	910003fd 	mov	x29, sp
  4007a0:	90000000 	adrp	x0, 400000 <_init-0x480>
  4007a4:	91266000 	add	x0, x0, #0x998
  4007a8:	528000a1 	mov	w1, #0x5                   	// #5
  4007ac:	97ffff51 	bl	4004f0 <printf@plt>*/
	printf("%d\n", 0x5);

  /*4007b0:	d503201f 	nop
  4007b4:	a8c17bfd 	ldp	x29, x30, [sp], #16
  4007b8:	d65f03c0 	ret*/
}

int main()
{
  /*4007bc:	a9bd7bfd 	stp	x29, x30, [sp, #-48]!
  4007c0:	910003fd 	mov	x29, sp
  4007c4:	52800020 	mov	w0, #0x1                   	// #1
  4007c8:	b9002fa0 	str	w0, [x29, #44]
  4007cc:	b9402fa0 	ldr	w0, [x29, #44] */
	int a = 1;

  /*4007d0:	7100001f 	cmp	w0, #0x0
  4007d4:	1a9f17e0 	cset	w0, eq  // eq = none
  4007d8:	12001c00 	and	w0, w0, #0xff
  4007dc:	b9002fa0 	str	w0, [x29, #44] */
	a = !a;

  /*4007e0:	90000000 	adrp	x0, 400000 <_init-0x480>
  4007e4:	9126a000 	add	x0, x0, #0x9a8
  4007e8:	b9402fa1 	ldr	w1, [x29, #44]
  4007ec:	97ffff41 	bl	4004f0 <printf@plt>*/
	printf("%d\n", a);

  /*4007f0:	97ffffe0 	bl	400770 <perfect>*/
	perfect();

  /*4007f4:	97ffffe9 	bl	400798 <perfect2>*/
	perfect2();

  /*4007f8:	d28000c0 	mov	x0, #0x6                   	// #6	x0=6
  4007fc:	f2a00200 	movk	x0, #0x10, lsl #16		// x0 = 0x10<<16 ==> x0 = 0x100006
  400800:	f90013a0 	str	x0, [x29, #32] */
	unsigned long d = 0x100006;

  /*400804:	f94013a0 	ldr	x0, [x29, #32]
  400808:	d350fc00 	lsr	x0, x0, #16			// x0 = d >> 16;
  40080c:	f9000fa0 	str	x0, [x29, #24] */
	long b = d >> 16;

  /*400810:	f94013a0 	ldr	x0, [x29, #32]		// x0 = d
  400814:	12001000 	and	w0, w0, #0x1f		// w0 = (d & 0x1f) 
  400818:	52800021 	mov	w1, #0x1                   	// #1
  40081c:	1ac02020 	lsl	w0, w1, w0			// w0 = 1 << (d & 0x1f) 
  400820:	51000400 	sub	w0, w0, #0x1		// w0 = (1 << (d & 0x1f)) - 1
  400824:	f9400fa1 	ldr	x1, [x29, #24]		// x1 = b
  400828:	1ac12000 	lsl	w0, w0, w1			// w0 = ((1 << (d & 0x1f)) - 1) << b
  40082c:	93407c00 	sxtw	x0, w0			// x0 = w0
  400830:	f9000ba0 	str	x0, [x29, #16] */
	long c = ((1 << (d & 0x1f)) - 1) << b;

  /*400834:	90000000 	adrp	x0, 400000 <_init-0x480>
  400838:	9126e000 	add	x0, x0, #0x9b8
  40083c:	f9400ba3 	ldr	x3, [x29, #16]
  400840:	f9400fa2 	ldr	x2, [x29, #24]
  400844:	f94013a1 	ldr	x1, [x29, #32]
  400848:	97ffff2a 	bl	4004f0 <printf@plt> */
	printf("%ld %ld %ld\n", d, b, c);

  /*40084c:	f9400ba0 	ldr	x0, [x29, #16]	// x0 = c
  400850:	92400000 	and	x0, x0, #0x1	// x0 = c & 0x1
  400854:	f9400fa1 	ldr	x1, [x29, #24]	// x1 = b;
  400858:	9ac12401 	lsr	x1, x0, x1		// x1 = (c & 0x1) >> b
  40085c:	90000000 	adrp	x0, 400000 <_init-0x480>
  400860:	91272000 	add	x0, x0, #0x9c8
  400864:	97ffff23 	bl	4004f0 <printf@plt>*/
	//printf("%d\n", (c & 0x1) >> b);

  /*400868:	2a0003e1 	mov	w1, w0
  40086c:	90000000 	adrp	x0, 400000 <_init-0x480>
  400870:	91274000 	add	x0, x0, #0x9d0
  400874:	97ffff1f 	bl	4004f0 <printf@plt>*/
	printf("%d\n", printf("%ld\n", (c & 0x1) >> b));

  /*400878:	52800000 	mov	w0, #0x0                   	// #0
  40087c:	a8c37bfd 	ldp	x29, x30, [sp], #48
  400880:	d65f03c0 	ret
  400884:	00000000 	.inst	0x00000000 ; undefined*/

  return 0;
}
